#pragma once
#include <Windows.h>
#include <tchar.h>

class CDUIBase
{
public:
	CDUIBase();
	virtual ~CDUIBase();
		
public: 
	virtual void SetRect(int x, int y, int cx, int cy);
	virtual void SetTexture(UINT* nResIDs, UINT nResCount);
	virtual void Draw(HDC& hDC) = 0;	
protected:
	POINT		m_ptPos;
	SIZE		m_szSize;
	HBITMAP*	m_pResList;
	UINT		m_nResCount;
};

class CDUICtrlBase : public CDUIBase
{
public:
	CDUICtrlBase(HWND hParent, UINT nID);
	virtual ~CDUICtrlBase(void);

public:
	virtual bool OnMessageHandle(UINT nMessage, WPARAM wParam, LPARAM lParam) = 0;

protected:
	HWND	m_hParent;
	UINT	m_nCtrlID;
};

class CDUICanvas : public CDUIBase
{
public:
	CDUICanvas();
	~CDUICanvas();

public:
	void Draw(HDC& hDC);	
};

class CDUIButton : public CDUICtrlBase
{
public:
	CDUIButton(HWND hParent, UINT nID);
	~CDUIButton();

public:
	void	Visible(bool bVisible);	
	void	Enable(bool bEnable);
	void	Draw(HDC& hDC);	
	bool	OnMessageHandle(UINT nMessage, WPARAM wParam, LPARAM lParam);

protected:
	bool	CursorInCtrl(LPARAM lParam);
	void	Redraw();
private:
	UINT	m_nCurSel;
	bool	m_bVisible;
	bool	m_bEnable;
	bool	m_bBtnDown;
};
